﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using QLTV_Public;
using System.Data;

namespace QLTV_Data
{
   public class ViPham_Data
    {
       KetNoiCSDL_Data kn = new KetNoiCSDL_Data();

       public DataTable TaoBang(string sql)
       {
           return kn.taobang(sql);
       }
       public DataTable LayDuLieu()
       {
           return kn.LayDuLieu("Load_ViPham");
       }
       public int Insert(ViPham_Pubic vp)
       {
           int n =6;
           string[] name = new string[n];
           object[] value = new object[n];
           name[0] = "@MaVipham";
           value[0] = vp.MaViPham;
           name[1] = "@NoiDung";
           value[1] = vp.NoiDung;
           name[2] = "@HinhThucXuLy";
           value[2] = vp.HinhThucXuLy;
           name[3] = "@MucPhat";
           value[3] = vp.MucPhat;
           name[4] = "@Status";
           value[4] = vp.Status;
           name[5] = "@GhiChu";
           value[5] = vp.GhiChu;

         return  kn.update("Insert_ViPham",name,value,n);
       }
       public int Update(ViPham_Pubic vp)
       {
           int n = 6;
           string[] name = new string[n];
           object[] value = new object[n];
           name[0] = "@MaViPham";
           value[0] = vp.MaViPham;
           name[1] = "@NoiDung";
           value[1] = vp.NoiDung;
           name[2] = "@HinhThucXuLy";
           value[2] = vp.HinhThucXuLy;
           name[3] = "@MucPhat";
           value[3] = vp.MucPhat;
           name[4] = "@Status";
           value[4] = vp.Status;
           name[5] = "@GhiChu";
           value[5] = vp.GhiChu;

           return kn.update("Update_ViPham", name, value, n);
       }
       public int Delete(ViPham_Pubic vp)
       {
           int n = 1;
           string[] name = new string[n];
           object[] value = new object[n];
           name[0] = "@MaViPham";
           value[0] = vp.MaViPham;

           return kn.update("Delete_ViPham", name, value, n);
       }
    }
}
